import java.util.Vector;

/**
 * @author gaopeng
 * @date 2019/12/15 3:18 下午
 */
public class UserIterator implements IUserIterator {
    private Vector<IUser> vector;
    private int cursor = 0;

    public UserIterator(Vector<IUser> vector) {
        this.vector = vector;
    }

    @Override
    public boolean hasNext() {
        if(cursor== vector.size()){
            return false;
        }else {
            return true;
        }
    }

    @Override
    public IUser next() {
        IUser result;
        if(hasNext()){
            result = this.vector.get(cursor++);
        }else{
            result = null;
        }
        return result;
    }
}
